import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)
export default new Router({
    routes: [
        {
            path:"/",
            component:()=>import('../components/Login.vue')
        },
        { 
            path:"/enroll",
            component:() =>import('../components/Enroll.vue')
        },
        {
            path:'/home',
            name:'Home',
            component:() => import('../components/Home.vue'),
            children:[
                {
                    name:'Search',
                    path:'/home/search',
                    component:()=>import('../views/Search.vue')
                },
                {
                    name:'List',
                    path:'/home/list',
                    component:()=>import('../views/List.vue')
                },
                {
                    name:'Im',
                    path:'/home/im',
                    component:()=>import('../views/Im.vue'),
                    meta:{index:0}
                }
            ]
            
        },
        {
            name:'Chatpage',
            path:'/chatpage',
            component:()=>import('../views/Chatpage')
        },
        {
            name:'Searchpage',
            path:'/searchpage',
            component:()=>import('../views/Searchpage.vue')
        },
        {
            name:'Addahomepage',
            path:'/addahomepage',
            component:()=>import('../views/Addahomepage.vue')
        },
        {
            name:'SetIm',
            path:'/setim',
            component:()=>import('../components/SetIm.vue'),
            meta:{index:1}
        },
        {
            name:'Deleteafriend',
            path:'/deleteafriend',
            component:()=>import('../components/Deleteafriend.vue'),
        }
        
    ]
})


const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

